cmake_minimum_required(VERSION 3.0.2)
project(can_device_interface)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
  message_generation
)

add_message_files(
  FILES
  canmsg.msg
)

generate_messages(
  DEPENDENCIES
  std_msgs
)



catkin_package(
INCLUDE_DIRS include
LIBRARIES can_device_interface
CATKIN_DEPENDS roscpp std_msgs message_runtime
DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)

## Declare a C++ library
add_library(${PROJECT_NAME}
  include/${PROJECT_NAME}/controlcan.h
  src/can_device_interface_node.cpp
  #src/can_device_pack_test.cpp
)

link_directories(
  lib
  ${catkin_LIB_DIRS}
)

add_executable(${PROJECT_NAME}_node src/can_device_interface_node.cpp)
add_executable(can_device_pack_test_node src/can_device_pack_test.cpp)
target_link_libraries(can_device_pack_test_node
  ${catkin_LIBRARIES}
  controlcan
)
target_link_libraries(${PROJECT_NAME}_node
  ${catkin_LIBRARIES}
  controlcan
)

